import store from '@/store'
import { mapGetters } from 'vuex'

export default {
  methods: {
    // 检测权限 key是要检测的点
    checkPermission(key) {
      // 个人资料userInfo
      const { userInfo } = store.state.user
      if (userInfo.roles && userInfo.roles.points && userInfo.roles.points.length) {
        // console.log(userInfo.roles.points)
        // 检测到就返回true  true为有权限
        return userInfo.roles.points.some(item => item === key)
      }
      return false
    }

  },
  computed: {
    ...mapGetters(['points'])
  }
}
